package com.voc.im.controller.item;

import com.voc.im.bean.ChatRecord;
import com.voc.im.model.ChatRecordModel;
import io.datafx.controller.FXMLController;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

@FXMLController("/fxml/window_chat_send_item.fxml")
public class ItemSendController {

    @FXML
    private AnchorPane anchor_pane_body;

    @Inject
    private ChatRecordModel chatRecordModel;

    @PostConstruct
    public void init() {
        ChatRecord chatRecord = chatRecordModel.getRecordListProperty(chatRecordModel.getObjectProperty().getValue()).get(chatRecordModel.getSelectedRecordIndex().get());
        Label label = getLabel();
        label.textProperty().bindBidirectional(chatRecord.bodyProperty());
        anchor_pane_body.getChildren().add(label);
    }

    /**
     * 文本视图
     */
    private Label getLabel() {
        String style = "-fx-text-fill: #ffffff;-fx-padding: 10;-fx-background-color: #5264AE; -fx-background-radius: 2px;";
        Label label = new Label();
        label.setMaxWidth(300f);
        label.setWrapText(true);
        label.setStyle(style);
        return label;
    }

    /**
     * 图片视图
     * */


    /**
     * 视频视图
     * */

    /**
     * 文件视图
     * */

    /**
     * 名片视图
     * */


}
